package com.zito.health.controller;

import com.zito.health.common.annotations.ResponseResult;
import com.zito.health.entity.Permission;
import com.zito.health.entity.User;
import com.zito.health.service.PermissionService;
import com.zito.health.util.CacheUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by gan on 2019/11/4.
 */
@Slf4j
@ResponseResult
@RestController
@RequestMapping("/permission")
public class PermissionController {

    @Autowired
    private PermissionService permissionService;

    @GetMapping("/userPermission")
    public List<Permission> userPermission(){
        User user = CacheUtil.getCacheUser().getUser();
        return permissionService.queryUserPermission(user.getUserid());
    }

}
